package com.xyy.saas.payment.service.impl;

import com.xyy.saas.payment.dao.mapper.ProfitSharingDetailMapper;
import com.xyy.saas.payment.dao.model.ProfitSharingDetail;
import com.xyy.saas.payment.service.ProfitSharingDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProfitSharingDetailServiceImpl implements ProfitSharingDetailService {

    @Autowired
    private ProfitSharingDetailMapper profitSharingDetailMapper;

    @Override
    public int insert(ProfitSharingDetail entity) {
        return profitSharingDetailMapper.insert(entity);
    }

    @Override
    public int udpateSelectiveById(ProfitSharingDetail entity) {
        return profitSharingDetailMapper.updateSelective(entity);
    }

    @Override
    public List<ProfitSharingDetail> queryByParam(ProfitSharingDetail param) {
        return profitSharingDetailMapper.selectByParam(param);
    }

    @Override
    public ProfitSharingDetail queryById(Long id) {
        return profitSharingDetailMapper.selectById(id);
    }

    @Override
    public ProfitSharingDetail deleteById(Long id) {
        ProfitSharingDetail profitSharingDetail = profitSharingDetailMapper.selectById(id);
        int rows = profitSharingDetailMapper.deleteById(id);
        if(rows < 1) {
            return null;
        }
        return profitSharingDetail;
    }
}